// 封装所有请求操作
import axios from '../../index'
import qs from 'qs'


// 获取数据库总条数
export const CountsList = (name) => {
    return axios({
        url: '/purSelStock/countDataBase',
        method: 'POST',
        data: qs.stringify(name)
    })
}

// 获取商品列表接口
export const commodityList = (datas) => {
    return axios({
        url: '/purSelStock/queryGoods',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 搜索商品接口
export const commoditySearch = (datas) => {
    return axios({
        url: '/purSelStock/searchGoods',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 获取商品种类接口
export const commodityType = (datas) => {
    return axios({
        url: '/purSelStock/queryGoodsType',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 添加商品接口
export const commodityAdd = (datas) => {
    return axios({
        url: '/purSelStock/addGoods',
        method: 'POST',
        data: datas,
    })
}

// 添加商品大类接口
export const commodityAddTypeB = (datas) => {
    return axios({
        url: '/purSelStock/addGoodsTypeGt_pno',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 添加商品小类接口
export const commodityAddTypeS = (datas) => {
    return axios({
        url: '/purSelStock/addGoodsTypeGt_name',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 修改商品接口
export const commodityEdit = (datas) => {
    return axios({
        url: '/purSelStock/updateGoods',
        method: 'POST',
        data: datas
    })
}

// 修改商品大类接口
export const commodityEditTypeB = (datas) => {
    return axios({
        url: '/purSelStock/updateGoodsTypeGt_pno',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 修改商品小类接口
export const commodityEditTypeS = (datas) => {
    return axios({
        url: '/purSelStock/updateGoodsTypeGt_name',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 删除商品接口
export const commodityDel = (datas) => {
    return axios({
        url: '/purSelStock/deleteGoods',
        method: 'POST',
        data: qs.stringify(datas)
    })
}

// 批量删除商品接口
export const commodityDelAll = (datas) => {
    return axios({
        url: '/purSelStock/batchDeleteGoods',
        method: 'POST',
        data: datas
    })
}

// 删除商品种类接口
export const commodityDelType = (datas) => {
    return axios({
        url: '/purSelStock/deleteGoodsType',
        method: 'POST',
        data: qs.stringify(datas)
    })
}